﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NDLS.WebApi.Model.ModelVM;
using RZWH.WebApi.IServices;
using RZWH.WebApi.Model.DBmodels;

namespace RZWH.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PhoneController : ControllerBase
    {
        private IPhoneService _phoneService;

        public PhoneController(IPhoneService phoneService)
        {
            _phoneService = phoneService;
        }

        [HttpPost]
        [Authorize(Policy = "Admin")]
        public MsgRes addNewPhone(Smartphone phone)
        {
            return _phoneService.addPhone(phone);
        }
    }
}
